//
//  HMUser.swift
//  sinaweibo
//
//  Created by WGP on 16/4/14.
//  Copyright © 2016年 WGP. All rights reserved.
//

import UIKit

class HMUser: NSObject {
    
//      用户UID
    var id: Int64 = 0
    
//   profile_image_url	string	用户头像地址（中图），50×50像素
    var profile_image_url: String?
    
//    screen_name	string	用户昵称
    var screen_name: String?
    
//    verified_type	int   认证类型  没有认证:-1   认证用户:0  企业认证:2,3,5  达人:220
    var verified_type: Int  = -1
    {
        didSet
        {
            switch verified_type
            {
            case 0:
                verifiedImage = UIImage(named: "avatar_vip")
            case 2,3,5:
                verifiedImage = UIImage(named: "avatar_enterprise_vip")
            case 220:
                verifiedImage = UIImage(named: "avatar_grassroot")
            default:
                verifiedImage = nil
            }
        }
    }
    
//    为了让外界用起来跟方便
    var verifiedImage: UIImage?
    
//   mbrank 会员等级
    var mbrank: Int = 0
    {
        didSet
        {
            if mbrank > 0 && mbrank <= 6
            {
                mbrankImage = UIImage(named: "common_icon_membership_level\(mbrank)")
            }
            else
            {
//                防止重用
                mbrankImage = nil
            }
        }
    }
    
    var mbrankImage: UIImage?
    
//创建世界爱你和来源在status模型里有
    
//        字典转模型
    init(dict: [String:AnyObject])
    {
        super.init()
        
        setValuesForKeysWithDictionary(dict)
    }
    
//    防止字典模型找不到对应的属性
    override func setValue(value: AnyObject?, forUndefinedKey key: String) {
        
    }
    
    

}











